<table id="edited-outlet" width="100%" class="dataTable">
  <thead>
    <tr>
      <th width="100px">ID Outlet</th>
      <th>Nama Outlet</th>
      <th>Alamat Outlet</th>
      <th>SFA/SGA</th>
    </tr>
  </thead>
  
  <tbody><!-- Here goes the datatables --></tbody>

</table>

<script type="text/javascript">
$(document).ready(function() {
  var user_group = <?php echo $this->session->userdata('group'); ?>;
  
  if(user_group == 4) 
    { var flag = 4; }
  else 
    { var flag = 3; }
  $('#edited-outlet').dataTable({
    "bProcessing": true,
    "bServerSide": true,
    // "bJQueryUI": true,
    "sAjaxSource": "<?php echo base_url('index.php/outlet/gridUnapproved/');?>/"+flag,
    "aoColumnDefs": [
      { "bSortable": false, "aTargets": [3] },
      { "bSearchable": false, "aTargets": [3] }
    ],
    "fnRowCallback": function(nRow, aaData, iDisplayIndex, iDisplayIndexFull) 
    {
      $(nRow).find('td').eq(-1).after('<td><?php echo $menu["edit"]; ?></td>');
      $.post(
        "<?=base_url();?>index.php/outlet/fogit/",
        {outlet_id:aaData[0]},
        function(response) {
          var jumlah_link = $('#edited-outlet tbody tr').eq(iDisplayIndex).find('a').length;
          for (var i = 0; i < jumlah_link; i++) {
            var href = $('#edited-outlet tbody tr').eq(iDisplayIndex).find('a').eq(i).attr('href');
            var new_href_edited = href+response;
            $('#edited-outlet tbody tr').eq(iDisplayIndex).find('a').eq(i).attr('href', new_href_edited);
          }
        }
      );
      return nRow;
    }

  });
  $('#edited-outlet thead tr').find('th').eq(-1).after('<th class="sorting_disabled" role="columnheader" rowspan="1" colspan="1" style="width: 250px" aria-label="maintainedBy"> Action</th>');

});
</script>